

jQuery.extend({
    
    Dialog:function(w,h,t,c){
        
        /* 创建遮罩层 */
        jQuery('<div>',{
        'id':'DL_bodyback',
        width:'100%',
        height:jQuery(document).height(),
        css:{
            'position':'absolute',
            'zIndex':'99997',
            'top':0,'left':0,
            'filter':'alpha(opacity=5)',
            'opacity':'0.05',
            'background':'#000000'
        }
        }).appendTo('body');
        
        
        jQuery('<div>',{
        'id':'DL_content',
        width:w,
        height:h,
        css:{
            'position':'absolute',
            'zIndex':'99998',
            'filter':'alpha(opacity=30)',
            'opacity':'0.3',
            'background':'#000000',
            'top':((jQuery(window).height() - h)/2 + jQuery(document).scrollTop()),
            'left':(jQuery(window).width() - w)/2,
        }
        }).appendTo('body');
        
        
        jQuery('<div>',{
        'id':'DL_content_info',
        width:w-16,
        height:h-16,class:'greybox',
        css:{
            'position':'absolute',
            'zIndex':'999999',
            'background':'#ffffff',
            'top':((jQuery(window).height() - h +16)/2 + jQuery(document).scrollTop()),
            'left':(jQuery(window).width() - w +16)/2
        },html:'<span class="box_title"><h2>'+t+'</h2><a href="javascript:void(0);" class="close" alt="关闭" title="关闭"></a></span><div class="blank10"></div>'+c
        }).appendTo('body');
        
        jQuery('#DL_content_info .close').click(function(){
            jQuery.Dialog_Close();
        });
    
    
    },
    Dialog_Close:function(){
    
        jQuery('#DL_bodyback,#DL_content,#DL_content_info').remove();
    }

});


var no_insert = 1;
var forms,albumid=0,uploadStat,picid,picurl,inputid;


function uploadsimg(id){
    inputid=id;
    jQuery.get('cp.php?ac=uploadudisk',{'inajax':1},function(msg){
    
        jQuery.Dialog(400,300,'上传文件',jQuery(msg).find('root').text());
    },'xml');

}





function u_passwordShow(value) {
    if(value==4) {
        jQuery('#span_password').show();
        jQuery('#tb_selectgroup').hide();
    } else if(value==2) {
        jQuery('#span_password').hide();
        jQuery('#tb_selectgroup').show();
    } else {
        jQuery('#span_password').hide();
        jQuery('#tb_selectgroup').hide();
    }
}
function u_getgroup(gid) {
    if(gid) {
        var x = new Ajax();
        jQuery.get('cp.php?ac=privacy&op=getgroup&gid='+gid,{'inajax':1}, function(msg){
            jQuery('#target_names').html(jQuery('#target_names').html()+jQuery(msg).find('root').text());
        },'xml');
    }
}

function u_album_op(id) {
    jQuery('#selectalbum,#creatalbum').hide();
    jQuery('#'+id).show();
}

function cannelupload(){
    $('btnupload').disabled = false;
}


function start_upload(){

    $('albumid').value = albumid;
    
    $('btnupload').disabled = true;
    
	var forms = $('attachbody').getElementsByTagName("FORM");
    
    jQuery('#localfile').html('上传中，请等待...');
    
    jQuery('#attach_upload').submit();
    
    
}

function upload() {

    if(uploadStat==1) {
        jQuery('#localfile').html('上传成功!');
        
        jQuery('#'+inputid).val(picurl);
        
        jQuery.Dialog_Close();
        
    }else{
        alert('上传失败!'+uploadStat);
        jQuery('#localfile').html('上传失败!');
        cannelupload();
    }


}






